package com.javafm.park.controller;

import com.javafm.park.config.DBConfig;
import com.javafm.park.dto.ParkListResponse;
import com.javafm.park.service.ParkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ParkController {

    @Autowired
    private ParkService parkService;
    @Autowired
    private DBConfig dbConfig;

    @GetMapping("/db-config")
    public String dbConfig() {
        return dbConfig.getUrl()  + " " + dbConfig.getUser() + " " +  dbConfig.getPassword();
    }

    @GetMapping("/park-list")
    public ParkListResponse parkList() {
        return new ParkListResponse(1001, "success", parkService.getParkList());
    }
}
